﻿<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
      Id="P3ToolsTab.DocumentGroup"
      RegistrationId="101"
      RegistrationType="List"
      Location="CommandUI.Ribbon">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.Templates._children">
          <GroupTemplate  Id="Ribbon.Templates.PDF2LibTemplate">
            <Layout
              Title="OneLargeTwoMedium"
              LayoutTitle="OneLargeTwoMedium">
              <Section  Alignment="Top" Type="OneRow">
                <Row>
                  <ControlRef  DisplayMode="Large" TemplateAlias="pdf2LibTemplate" />
                </Row>
              </Section>
            </Layout>
          </GroupTemplate>
        </CommandUIDefinition>
        <CommandUIDefinition Location="Ribbon.P3ToolsTab.Scaling._children">
          <MaxSize
            Id="Ribbon.P3ToolsTab.Documents.MaxSize"
  Sequence="65"
  GroupId="Ribbon.P3ToolsTab.DocumentGroup"
  Size="OneLargeTwoMedium" />

        </CommandUIDefinition>
        <CommandUIDefinition Location="Ribbon.P3ToolsTab.Groups._children">
          <Group
            Id="Ribbon.P3ToolsTab.DocumentGroup"
            Description="Provides special document functions"
            Title="Document Actions"
            Sequence="52"
            Template="Ribbon.Templates.PDF2LibTemplate">
            <Controls  Id="Ribbon.P3ToolsTab.DocumentGroup.Controls">
              <Button
                 Id="Ribbon.P3ToolsTab.DocumentGroup.PDF2LibButton"
                 Command="P3ToolsTab.PDF2LibCommand"
                 Sequence="15"
                 Description=""
                 LabelText="PDF to Library"
                 Image32by32="/_layouts/images/PDF2Lib/pdf2lib.png"
                 TemplateAlias="pdf2LibTemplate"/>
            </Controls>

          </Group>

        </CommandUIDefinition>

      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler
            Command="P3ToolsTab.PDF2LibCommand"
             CommandAction="javascript: function openPDF2LibConfigDialog()
                                        {
                                           var site='{SiteUrl}'; 
                                           var url = site + '/_layouts/P3/PDF2LibConfig.aspx?ListId={ListId}';
                                                                                      
                                          var options = {
                                            url: url,
                                            width: 1050,                                            
                                        };

                                            SP.UI.ModalDialog.showModalDialog(options);
                                        }
                                        
                                        openPDF2LibConfigDialog();"  />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
</Elements>
